/**
 * 
 */
package ch.unisi.inf.gui;
import ch.unisi.inf.engine.*;
import ch.unisi.inf.gui.action.*;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;



/**
 * @author canova
 *
 */
public class ButtonPanel extends JPanel{
	
	private final static int GAP_ICON = 0;
	JButton openButton;
	JButton removeButton;
	JButton editButton;
	JButton printButton;
	JButton mailButton;
	private JFrame frame;
	private Image image;
	private Library library;
	 
	public ButtonPanel(){
		
		this.setPreferredSize(new Dimension(900, 100));
		this.setBackground(Color.YELLOW);
		this.setLayout(new FlowLayout());
		
		openButton = new JButton(new OpenAction()); // here is the trick
		openButton.setText("");
		openButton.setIconTextGap(GAP_ICON);
		openButton.setIcon(new ImageIcon("src/images/open.png"));
		openButton.setRolloverIcon(new ImageIcon("src/images/openover.png"));
		openButton.setPressedIcon(new ImageIcon("src/images/openover.png"));
		openButton.setBorderPainted(false);
		openButton.setContentAreaFilled(false);
		
		
		
		removeButton = new JButton(new RemoveAction(frame, library, image));
		removeButton.setText("");
		removeButton.setIconTextGap(GAP_ICON);
		removeButton.setIcon(new ImageIcon("src/images/close.png"));
		removeButton.setRolloverIcon(new ImageIcon("src/images/closeover.png"));
		removeButton.setPressedIcon(new ImageIcon("src/images/closeover.png"));
		removeButton.setBorderPainted(false);
		removeButton.setContentAreaFilled(false);
		
		editButton = new JButton();//new EditAction(this, null));
		editButton.setText("");
		editButton.setIconTextGap(GAP_ICON);
		editButton.setIcon(new ImageIcon("src/images/edit.png"));
		editButton.setRolloverIcon(new ImageIcon("src/images/editover.png"));
		editButton.setPressedIcon(new ImageIcon("src/images/editover.png"));
		editButton.setBorderPainted(false);
		editButton.setContentAreaFilled(false);
		
		printButton = new JButton(new PrintAction());
		printButton.setText("");
		printButton.setIconTextGap(GAP_ICON);
		printButton.setIcon(new ImageIcon("src/images/print.png"));
		printButton.setRolloverIcon(new ImageIcon("src/images/printover.png"));
		printButton.setPressedIcon(new ImageIcon("src/images/printover.png"));
		printButton.setBorderPainted(false);
		printButton.setContentAreaFilled(false);
		
		

		mailButton = new JButton(new MailAction(null));
		mailButton.setText("");
		mailButton.setIconTextGap(GAP_ICON);
		mailButton.setIcon(new ImageIcon("src/images/mail.png"));
		mailButton.setRolloverIcon(new ImageIcon("src/images/mailover.png"));
		mailButton.setPressedIcon(new ImageIcon("src/images/mailover.png"));
		mailButton.setBorderPainted(false);
		mailButton.setContentAreaFilled(false);
		
		this.add(openButton);
		this.add(removeButton);
		this.add(editButton);
		this.add(printButton);
		this.add(mailButton);
		
	}

}
